package DB;

import java.sql.Connection;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;

public class DBUtils {
	public static ResultSet executeQuery(String query) {
		ConnectionManager mgr = ConnectionManager.getInstance();
		Connection con = mgr.getConnection();
		ResultSet result = null;
		try {
			Statement st = con.createStatement() ;
			result = st.executeQuery(query);
		} catch (SQLException e) {
			e.printStackTrace();
		}
		return result;
	}
	
	public static void executeUpdate(String query) {
		ConnectionManager mgr = ConnectionManager.getInstance();
		Connection con = mgr.getConnection();
		try {
			Statement st = con.createStatement() ;
			st.executeUpdate(query);
			st.close();
			
		} catch (SQLException e) {
			e.printStackTrace();
		}
		mgr.closeConnection(con);
	}
}
